package org.bean;

import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;

import org.utils.RemoteUtil;

import com.sojoys.artifact.tools.ToolMap;

/**
 * @author : DengYing
 * @CreateDate : 2017年11月29日 上午10:29:52
 * @Description ：玩家信息
 */
public class PlayerInfo {
	
	/** 玩家ID */
	public static final int PID = 1;
	/** 玩家等级 */
	public static final int LVL = 2;
	/** 战斗力 */
	public static final int FIGHT_POWER = 3;
	/** 在线 */
	public static final int ONLINE = 4;
	/** 名字 */
	public static final int NAME = 5;
	/** 账号ID */
	public static final int UID = 6;
	/** 语言 */
	public static final int LANGUAGE = 7;
	/** VIP等级 */
	public static final int VIP = 8;
	/** 助战英雄CID */
	public static final int HELP_HERO_CID = 9;
	/** 最后登录时间 */
	public static final int LAST_LOGIN_DATE = 10;
	/** 服务器ID */
	public static final int SRVER_ID = 11;
	/** 总充值金额 */
	public static final int TOTAL_RECHARGE_MONEY = 12;
	/** 最后离线时间 */
	public static final int LAST_OFFLINE_DATE = 13;
	
//	/** 平台 */
//	public static final int PLATFORM = 12;
//	/** 渠道 */
//	public static final int CHANNEL_ID = 13;
//	/** 渠道APP_ID */
//	public static final int CHANNEL_APP_ID = 14;


	//*****************************************分割线*****************************************
	
	/** 玩家ID */
	private int pid;
	/** 玩家等级 */
	private int lvl;
	/** 战斗力 */
	private int fightPower;
	/** 在线 */
	private boolean online;
	/** 名字 */
	private String name;
	/** 账号ID */
	private String uid;
	/** 语言 */
	private String language;
	/** VIP等级 */
	private int vip;
	/** 助战英雄CID */
	private int helpHeroCid;
	/** 最后登录时间 */
	private Date lastLoginDate;
	/** 最后离线时间 */
	private Date lastOfflineDate;
	/** 服务器ID */
	private String serverId;
	/**累积充值金额*/
	private int totalRechargeMoney;
//	// 新手引导
//	private String newPlayerGuide;

	/**
	 * 上传PlayerInfo信息
	 * @param map
	 * @param upload
	 */
	public void upload(Map<Integer, Object> map){
		for (Entry<Integer, Object> e : map.entrySet()) {
			int key = e.getKey();
			switch (key) {
			case PID:
				this.pid = ToolMap.getInt(key, map , this.pid);
				break;
			case LVL:
				this.lvl = ToolMap.getInt(key, map,this.lvl);
				break;
			case FIGHT_POWER:
				this.fightPower = ToolMap.getInt(key, map,this.fightPower);
				break;
			case ONLINE:
				this.online = ToolMap.getBoolean(key, map,this.online);
				break;
			case NAME:
				this.name = ToolMap.getString(key, map,this.name);
				break;
			case UID:
				this.uid = ToolMap.getString(key, map,this.uid);
				break;
			case LANGUAGE:
				this.language = ToolMap.getString(key, map,this.language);
				break;
			case VIP:
				this.vip = ToolMap.getInt(key, map,this.vip);
				break;
			case HELP_HERO_CID:
				this.helpHeroCid = ToolMap.getInt(key, map , this.helpHeroCid);
				break;
			case LAST_LOGIN_DATE:
				this.lastLoginDate = ToolMap.getDate(key, map, this.lastLoginDate);
				break;
			case SRVER_ID:
				this.serverId = ToolMap.getString(key, map, this.serverId);
				break;
			case TOTAL_RECHARGE_MONEY:
				this.totalRechargeMoney = ToolMap.getInt(key, map, this.totalRechargeMoney);
				break;
			case LAST_OFFLINE_DATE:
				this.lastOfflineDate = ToolMap.getDate(key, map, this.lastOfflineDate);
				break;
			}
		}
		RemoteUtil.socialAsyn().uploadPlayerInfo(this.pid,this.serverId, map);
	}
	
	public int getPid() {
		return pid;
	}

	public void setPid(int pid) {
		this.pid = pid;
	}

	public int getLvl() {
		return lvl;
	}

	public void setLvl(int lvl) {
		this.lvl = lvl;
	}

	public int getFightPower() {
		return fightPower;
	}

	public void setFightPower(int fightPower) {
		this.fightPower = fightPower;
	}

	public boolean isOnline() {
		return online;
	}

	public void setOnline(boolean online) {
		this.online = online;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public int getVip() {
		return vip;
	}

	public void setVip(int vip) {
		this.vip = vip;
	}

	public int getHelpHeroCid() {
		return helpHeroCid;
	}

	public void setHelpHeroCid(int helpHeroCid) {
		this.helpHeroCid = helpHeroCid;
	}

	public Date getLastLoginDate() {
		return lastLoginDate;
	}

	public void setLastLoginDate(Date lastLoginDate) {
		this.lastLoginDate = lastLoginDate;
	}

	public String getServerId() {
		return serverId;
	}

	public void setServerId(String serverId) {
		this.serverId = serverId;
	}

	public int getTotalRechargeMoney() {
		return totalRechargeMoney;
	}

	public void setTotalRechargeMoney(int totalRechargeMoney) {
		this.totalRechargeMoney = totalRechargeMoney;
	}
	
	

//	public String getPlatform() {
//		return platform;
//	}
//
//	public void setPlatform(String platform) {
//		this.platform = platform;
//	}
//
//	public String getChannelId() {
//		return channelId;
//	}
//
//	public void setChannelId(String channelId) {
//		this.channelId = channelId;
//	}
//	
//	public String getChannelAppId() {
//		return channelAppId;
//	}
//
//	public void setChannelAppId(String channelAppId) {
//		this.channelAppId = channelAppId;
//	}

	public Date getLastOfflineDate() {
		return lastOfflineDate;
	}

	public void setLastOfflineDate(Date lastOfflineDate) {
		this.lastOfflineDate = lastOfflineDate;
	}

	@Override
	public String toString() {
		return "PlayerInfo [pid=" + pid + ", lvl=" + lvl + ", fightPower=" + fightPower + ", online=" + online
				+ ", name=" + name + ", uid=" + uid + ", language=" + language + ", vip=" + vip + ", helpHeroCid="
				+ helpHeroCid + ", lastLoginDate=" + lastLoginDate + ", serverId=" + serverId + "]";
	}
	
	
}
